home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
src
/
fig08_06.jar
/
Ch08
/
Fig08_06
/
Date1.h
< prev
next >
Wrap
C/C++ Source or Header
|
1997-10-27
|
799b
|
30 lines
// Fig. 8.6: date1.h
// Definition of class Date
#ifndef DATE1_H
#define DATE1_H
#include <iostream.h>
class Date {
friend ostream &operator<<( ostream &, const Date & );
public:
Date( int m = 1, int d = 1, int y = 1900 ); // constructor
void setDate( int, int, int ); // set the date
Date &operator++(); // preincrement operator
Date operator++( int ); // postincrement operator
const Date &operator+=( int ); // add days, modify object
bool leapYear( int ); // is this a leap year?
int endOfMonth( int ); // is this end of month?
private:
int month;
int day;
int year;
static const int days[]; // array of days per month
void helpIncrement(); // utility function
};
#endif